QuickOPC User's Guide and Reference
Examples - OPC Data Access - Browse for access paths

.NET

// This example shows how to obtain all access paths available for an item.

using System;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.DataAccess._EasyDAClient
{
    class BrowseAccessPaths
    {
        public static void Main1()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();
            string[] accessPaths;
            try
            {
                accessPaths = client.BrowseAccessPaths("OPCLabs.KitServer.2", "Simulation.Random");
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            for (int i = 0; i < accessPaths.Length; i++)
                Console.WriteLine($"accessPaths({i}): {accessPaths[i]}");
        }


        // Example output:
        //
        //accessPaths(0): Self
        //accessPaths(1): Other
    }
}
# This example shows how to obtain all access paths available for an item.

# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc

# Import .NET namespaces.
from OpcLabs.EasyOpc.DataAccess import *
from OpcLabs.EasyOpc.OperationModel import *


# Instantiate the client object.
client = EasyDAClient()

# Perform the operation
try:
    accessPaths = IEasyDAClientExtension.BrowseAccessPaths(client, '', 'OPCLabs.KitServer.2', 'Simulation.Random')
except OpcException as opcException:
    print('*** Failure: ' + opcException.GetBaseException().Message)
    exit()

# Display results
for (i, accessPath) in enumerate(accessPaths):
    print('accessPaths[', i, ']: ', accessPath, sep='')

COM

Rem This example shows how to obtain all access paths available for an item.

Option Explicit

Dim ServerDescriptor: Set ServerDescriptor = CreateObject("OpcLabs.EasyOpc.ServerDescriptor")
ServerDescriptor.ServerClass = "OPCLabs.KitServer.2"

Dim NodeDescriptor: Set NodeDescriptor = CreateObject("OpcLabs.EasyOpc.DataAccess.DANodeDescriptor")
NodeDescriptor.ItemID = "Simulation.Random"

Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.DataAccess.EasyDAClient")
On Error Resume Next
Dim accessPaths: accessPaths = Client.BrowseAccessPaths(ServerDescriptor, NodeDescriptor)
If Err.Number <> 0 Then
    WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description
    WScript.Quit
End If
On Error Goto 0

Dim i: For i = LBound(accessPaths) To UBound(accessPaths)
    WScript.Echo "accessPaths(" & i & "): " & accessPaths(i)
Next

 

See Also

Conceptual